import 'package:flutter/material.dart';

class EgHero extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("演示Hero"),
      ),
      body: new Center(
        child: new GestureDetector(
          child: new Hero(
              tag: "缩略图",
              child: new Center(
                child: new Container(
                  width: 300,
                  height: 300,
                  child: new Image.network(
                    "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2532879260,2161329853&fm=27&gp=0.jpg",
                    fit: BoxFit.contain,
                  ),
                ),
              )),
          onTap: () {
            Navigator.push(context, new MaterialPageRoute(builder: (context) {
              return EgHeroDetail();
            }));
          },
        ),
      ),
    );
  }
}

class EgHeroDetail extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("演示Hero"),
      ),
      body: new GestureDetector(
        child: new Hero(
            tag: "缩略图",
            child: new Container(
              width: 300,
              height: 300,
              child: new Image.network(
                "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3817191486,3276892468&fm=26&gp=0.jpg",
                fit: BoxFit.contain,
              ),
            )),
        onTap: () {
          Navigator.pop(context);
        },
      ),
    );
  }
}
